/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.geftu.util;

import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

/**
 *
 * @author Nei
 */
public class ProtegerSenha {
    String senha = null;
    
    public String geraHash(String original){

        try {
             MessageDigest algorithm = MessageDigest.getInstance("SHA");
                     byte messageDigest[] = algorithm.digest(original.getBytes("UTF-8"));
                     
                     StringBuilder hexString = new StringBuilder();
                     for(byte b : messageDigest){
                         hexString.append(String.format("%02X",0xFF & b));
                     }
                     senha = hexString.toString();
                     
                             
                     
                   //  System.out.println(senha);
        } catch (UnsupportedEncodingException | NoSuchAlgorithmException e) {
        }
        return senha;
                    
        
    }
    
}
